home *** CD-ROM | disk | FTP | other *** search
- Path: in1.uu.net!DIALix!gmhuucp!chris.cheek
- Newsgroups: comp.lang.c
- In-Reply-To: who.ever.asked@ucagmh.DIALix.oz.au
- Subject: Re: rebooting computer in C.
- From: chris.cheek@ucagmh.DIALix.oz.au
- Message-ID: <COLACE.9807@ucagmh.DIALix.oz.au>
- Date: Tue, 6 Feb 96 20:48:00 +0730
- Organization: The Flaming Dove, Karratha WA
-
- >In article <4emjjj$713@donatello.leonardo.net>, DavidJo@zianet.com (DavidJo)
- >ites...
- >>How would I go about making the computer reboot from inside a C
- >>program?
- >
- >How you do this (or _if_ you can) depends on your operating system, so you
- >should ask this in a group dedicated to that operating system. The C langua
- >itself has no support for this sort of operation.
- >
- >If you are using MS-DOS, ask in comp.os.msdos.programmer, but first have a l
- >by anonymous ftp at rtfm.mit.edu for that group's FAQ, which probably covers
- >this topic. (Although I don't know _why_ you would want to do this - the la
- >thing I want _any_ program to do is to reboot the machine...)
- >
- >
- >Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- >Internet: bennett@triumf.ca | of one another only when one can be
- >Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- >TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- >GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
- >
-
- Far-out do i have to help everyone in this confrence????
- :-(( here is some source to get ya go-in from Aust!
-
-
- #define COLD 0 /* for cold boot */
- /* #define WARM 0x1234 /* for warm boot */
-
- #define BOOT_SEG 0xffffL
- #define BOOT_OFF 0x0000L
- #define BOOT_ADR ((BOOT_SEG << 16) | BOOT_OFF)
-
- #define DOS_SEG 0x0040L
- #define RESET_FLAG 0x0072L
- #define RESET_ADR ((DOS_SEG << 16) | RESET_FLAG)
-
- main()
- {
- void ((far *fp)()) = (void (far *)()) BOOT_ADR;
-
- *(int far *)RESET_ADR = COLD;
- (*fp)();
- return 0;
- }
-
- /* -Chris */
- oh and good luck with rebooting ya computer...
-